/*
 * @Description:
 * @Author: xiaenming
 * @Date: 2023-12-06 10:24:05
 * @LastEditTime: 2023-12-06 13:38:18
 * @LastEditors: xiaenming
 */
#ifndef _TM8211_H_
#define _TM8211_H_

#include "main.h"

#define TM8211_DELAY_TIME 2

typedef struct
{
    GPIO_TypeDef *WS_port;
    uint16_t WS_pin;
    GPIO_TypeDef *BCK_port;
    uint16_t BCK_pin;
    GPIO_TypeDef *DIN_port;
    uint16_t DIN_pin;

    uint16_t ch1_val;
    uint16_t ch2_val;
    uint16_t ref_volt;
} TM8211_t;

typedef enum
{
    TM8211_CH1,
    TM8211_CH2
} tm8211_ch_t;

void TM8211_set_ch_volt(TM8211_t *tm8211, tm8211_ch_t ch, uint16_t volt);

#endif
